(de pr-str (Ast PrintReadably)
   (let Value (MAL-value Ast)
      (case (MAL-type Ast)
         ((true false nil)
          (sym @) )
         (string (if PrintReadably (repr Value) Value))
         (keyword (pack ":" Value))
         ((number symbol) Value)
         (fn "#<subr>")
         (func "#<func>")
         (list (pr-list Value PrintReadably "(" ")"))
         (vector (pr-list Value PrintReadably "[" "]"))
         (map (pr-list Value PrintReadably "{" "}"))
         (atom (pack "(atom " (pr-str Value PrintReadably) ")"))
         (T (pretty Value) (throw 'err (MAL-error (MAL-string "[pr-str] unimplemented type")))) ) ) )

(de repr (X)
   (let Chars (chop X)
      (if (not X)
         "\"\""
         (setq Chars (replace Chars "\\" "\\\\"))
         (setq Chars (replace Chars "\"" "\\\""))
         (setq Chars (replace Chars "\n" "\\n"))
         (pack "\"" Chars "\"") ) ) )

(de pr-list (Forms PrintReadably Starter Ender)
   (let Values (mapcar '((Form) (pr-str Form PrintReadably)) Forms)
      (pack Starter (glue " " Values) Ender) ) )
